/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.jfonia.model.elements;

import org.jfonia.connect5.basics.BasicValueNode;
import org.jfonia.connect5.basics.MutableValueNode;

/**
 *
 * @author Rik Bauwens
 */
public class Tone extends MusicalElement implements IStaffElement
{
        /* Interval corresponding with this node (rank on staff)
         * If this object is null, this Tone is a rest (a rest has no staffrank)
         */
        private MutableValueNode<Integer> base40RankNode;
        
        public Tone()
        {
                this(0);
        }

        public Tone(int difference)
        {
                super(difference);
                base40RankNode = new BasicValueNode<Integer>(null);
        }

        public MutableValueNode<Integer> getBase40RankNode()
        {
                return base40RankNode;
        }

        public Integer getBase40Rank()
        {
                return base40RankNode.getValue();
        }

        public Tone setBase40Rank(int base40Rank)
        {
                base40RankNode.setValue(base40Rank);
                return this;
        }

        @Override
        public Tone clone(){
            Tone tone = new Tone(getDifference());
            if(getBase40Rank() != null){
                Integer base40Rank = getBase40Rank();
                if(base40Rank != null)
                        tone.setBase40Rank(new Integer(base40Rank));
            }
            return tone;
        }
}
